<?php

class MailTable extends Doctrine_Table
{

    /**
     * Return the number of mails in the specified status for the specified campaign
     * @param integer $campaignId
     * @param string $status
     * @return integer
     */
    public function countMailsForCampaign($campaignId, $status = 'SENT'){
        $q = $this->createQuery('m')->where('m.campaign_id = ?', $campaignId)->andWhere('m.status = ?', $status);
        return $q->count();
    }

}
